package team.yidong.fenda.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.w3c.dom.stylesheets.LinkStyle;
import team.yidong.fenda.entity.WxOrder;

import java.util.List;

/**
 * Created by xuanlong on 2017/12/17.
 */
@Repository
public interface WxOrderRepository extends JpaRepository<WxOrder, Integer>, JpaSpecificationExecutor<WxOrder> {
    WxOrder findByOutTradeNo(String outTradeNo);

    @Query("select wxOrder from WxOrder wxOrder where wxOrder.status='start'")
    List<WxOrder> findStartOrder();

    @Query("select wxOrder from WxOrder wxOrder where wxOrder.handleStatus='免费'")
    List<WxOrder> findFreeQuestion();

    @Query("select wxOrder from WxOrder wxOrder where wxOrder.orderQuestion.id=?1")
    WxOrder findByQuestionId(Integer questionId);

}
